<%@ page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="java.io.IOException" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit"><!-- 启用浏览器的极速模式(webkit) -->
    <meta name="author" content="Jay Chen">
    <script type="text/javascript">
    </script>
</head>
<body>
<h2>接口授权</h2>
<%!
    private void writeResult(HttpServletRequest request, HttpServletResponse response) {
        try {
            PrintWriter writer = response.getWriter();

            String accessToken = request.getParameter("access_token");
            String clientid = request.getParameter("client_id");
            if (accessToken != null) {
                writer.write("<p>login success</p>");
                writer.write("<p>access_token:" + accessToken + "</p>");
                writer.write("<p>client_id:" + clientid + "</p>");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
%>

<p><%
    writeResult(request, response);
%><p/>
<form action="http://test.kuaihuoyun.com:7070/login.html" method="get">
    <input id="redirectUri" type="hidden" name="redirectUri"/>
    <input type="submit" value="绑定ctms账号" >
</form>
</body>
<script type="text/javascript">
    var red = document.getElementById('redirectUri');
    red.value = window.location.href;
</script>
</html>
